package com.wzh.mall.cart.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * @program: mall
 * @description: 购物车中的每一项的信息
 * @author: Mr.Wang
 * @create: 2021-09-17 16:36
 **/

public class CartItem {

    private Long skuId;
    // 商品是否被选中 默认是被选中
    private Boolean check = true;
    // 商品的标题
    private String title;
    // 商品的图片信息
    private String image;
    // 商品的属性信息 （商品的套餐）
    private List<String> skuAttr;
    // 商品的单价
    private BigDecimal price;
    // 被选中的商品的数量
    private Integer count;
    // 商品的总价钱
    private BigDecimal totalPrice;

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Boolean getCheck() {
        return check;
    }

    public void setCheck(Boolean check) {
        this.check = check;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public List<String> getSkuAttr() {
        return skuAttr;
    }

    public void setSkuAttr(List<String> skuAttr) {
        this.skuAttr = skuAttr;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    /**
      * @Description: 计算当前项的总价
      * @Param: [totalPrice]
      * @return: void
      * @Author: Mr.Wang
      * @Date: 2021/9/17
      * @Time: 16:43
      */      
      
    public void setTotalPrice(BigDecimal totalPrice) {

        this.totalPrice = totalPrice;
    }

    public BigDecimal getTotalPrice(){
        return this.price.multiply(new BigDecimal(this.count + ""));
    }

}
